package com.longshihan.news.ui.main.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.longshihan.news.R;
import com.longshihan.news.listener.OnEndListener;
import com.longshihan.news.widegt.WowSplashView;
import com.longshihan.news.widegt.WowView;


public class WowActivity extends AppCompatActivity {
    private WowSplashView mWowSplashView;
    private WowView mWowView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wow);

        mWowSplashView = (WowSplashView) findViewById(R.id.wowSplash);
        mWowView = (WowView) findViewById(R.id.wowView);
        mWowSplashView.startAnimate();
        mWowSplashView.setOnEndListener(new OnEndListener() {
            @Override
            public void onEnd(View wowSplashView) {
                mWowSplashView.setVisibility(View.GONE);
                mWowView.setVisibility(View.VISIBLE);
                mWowView.startAnimate(wowSplashView.getDrawingCache());
            }
        });

        mWowView.setOnEndListener(new OnEndListener() {
            @Override
            public void onEnd(View wowSplashView) {
                Intent intent = new Intent();
                intent.setClass(WowActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            }
        });

        //心跳保活
        //startService(new Intent(this, LocalService.class));
        //startService(new Intent(this, RemoteService.class));
        //startService(new Intent(this, JobHandleService.class));
    }


}
